﻿<UserControl x:Class="Animator3D.Controls.Viewport2D"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:s="clr-namespace:System;assembly=mscorlib" 
	  xmlns:loc="clr-namespace:Animator3D.Controls"
     x:Name="Viewport2DControl"
    HorizontalAlignment="Stretch" VerticalAlignment="Stretch" SizeChanged="UserControl_SizeChanged" ClipToBounds="True">
	<UserControl.Resources>
		<ObjectDataProvider MethodName="GetValues"
                          ObjectType="{x:Type s:Enum}"
                          x:Key="CameraOrientationsValuesProvider">
			<ObjectDataProvider.MethodParameters>
				<x:Type TypeName="loc:CameraOrientations"/>
			</ObjectDataProvider.MethodParameters>
		</ObjectDataProvider>
	</UserControl.Resources>
	<Grid x:Name="Containers">
		<Grid x:Name="BackdropContainer"/>
		<Grid>
			<Canvas x:Name="GridsContainer" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
		</Grid>
		<Grid x:Name="BonesContainer"/>
		<Grid x:Name="SelectedBonesContainer" />
		<Grid x:Name="ModelContainer"/>
        <Grid>
            <Canvas x:Name="SelectedPointsContainer" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
        </Grid>
        <Grid>
            <Canvas x:Name="AttachedPointsContainer"  Visibility="Hidden" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
        </Grid>
        <Grid>
            <Canvas x:Name="SelectorContainer" Visibility="Hidden" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                <Path Stroke="LightBlue" Fill="#3F3F3FFF">
                    <Path.Data>
                        <RectangleGeometry x:Name="SelectionBox">
                            <RectangleGeometry.Rect>
                                <Rect X="0" Y="0" Width="10" Height="10"/>
                            </RectangleGeometry.Rect>
                        </RectangleGeometry>
                    </Path.Data>
                </Path>
            </Canvas>
        </Grid>
        <Grid>
            <Canvas x:Name="DeselectorContainer" Visibility="Hidden" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                <Path Stroke="Orange" Fill="#3FFF3F3F">
                    <Path.Data>
                        <RectangleGeometry x:Name="DeselectionBox">
                            <RectangleGeometry.Rect>
                                <Rect X="0" Y="0" Width="10" Height="10"/>
                            </RectangleGeometry.Rect>
                        </RectangleGeometry>
                    </Path.Data>
                </Path>
            </Canvas>
        </Grid>
        <ComboBox HorizontalAlignment="Left" VerticalAlignment="Top" Margin="1,1,0,0" Opacity="0.5" 
					ItemsSource="{Binding Source={StaticResource CameraOrientationsValuesProvider}}"
					Text="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type loc:Viewport2D}}, Path=CameraOrientation}" >
			<ComboBox.Triggers>
				<EventTrigger RoutedEvent="Mouse.MouseEnter">
					<BeginStoryboard>
						<Storyboard>
							<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(UIElement.Opacity)">
								<SplineDoubleKeyFrame KeyTime="00:00:00.5" Value="1"/>
							</DoubleAnimationUsingKeyFrames>
						</Storyboard>
					</BeginStoryboard>
				</EventTrigger>
				<EventTrigger RoutedEvent="Mouse.MouseLeave" >
					<BeginStoryboard >
						<Storyboard>
							<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(UIElement.Opacity)">
								<SplineDoubleKeyFrame KeyTime="00:00:00.5" Value="0.5" />
							</DoubleAnimationUsingKeyFrames>
						</Storyboard>
					</BeginStoryboard>
				</EventTrigger>
			</ComboBox.Triggers>
		</ComboBox>
	</Grid>

</UserControl>
